# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : p25.py
# @Time     : 2024/5/12 19:06
# @Author   : Robot-Zsj
"""
description:


数组连续喝

https://fcqian.blog.csdn.net/article/details/127170844

i:
3 7
3 4 7

o:
4
"""
N, x = map(int, input().split())
nums = list(map(int, input().split()))


def solution():
    ans = 0

    l = 0
    r = 0

    window_sum = 0

    while r < N:
        if r < l or window_sum + nums[r] < x:
            window_sum += nums[r]
            r += 1
        else:
            ans += N - r
            window_sum -= nums[l]
            l += 1
    return ans


print(solution())
